package servlets;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class DeleteJob extends HttpServlet {

	Connection conn = null;
	Statement stmt = null;

	public void doPost(HttpServletRequest req, HttpServletResponse res)
			throws ServletException, IOException {
		try {
			// Get a Connection to the database
			conn = DatabaseConection.getConnectionToDB();
			stmt = conn.createStatement();
			// Add the data into the database
			String sql = "delete from authors where ida="
					+ req.getParameter("ida");
			stmt.executeUpdate(sql);
			System.out.println(sql);
			res.sendRedirect("http://localhost:8080/RoadRunner/");
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
		}

	}
}
